package com.xyz.mapper;

import com.xyz.entity.Commodity;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ComMapper {
    @Insert("insert into commodity(comname,price,owner_id,description,status,image,create_time,update_time,type)"
            +"values (#{comname},#{price},#{ownerId},#{description},#{status},#{image},#{createTime},#{updateTime},#{type})")
    void insert(Commodity commodity);

    //删除数据
    @Delete("delete from commodity where comid=#{comid}")
    public void delete(Integer comid);

    //修改商品信息,必须有所限制，有做修改
    public void update(Commodity commodity);

    //查询所有数据
    @Select("select comid,comname,price,status,image,description from commodity where owner_id=#{userid} ")
   public  List<Commodity> list(Integer userid);


    //分页查询
//    @Select("select * from commodity  ")
    public List<Commodity> page(@Param("type")String type);

    @Select("select count(*) from commodity ")
    public long count();
}
